<template>
  <div class="app-container" ref="content">
    <div style="text-align: center;padding: 10px">待办详情信息</div>
      <div style="margin: 10px auto;text-align: center">
          <el-button type="primary" size="mini"  @click="toSource" align="center">待办事件详情</el-button>
      </div>
      <div style="width: 50%;margin:0px auto;vertical-align:middle;height:100%">
      <el-form :model="agencyInfo" ref="agencyInfo" label-width="150px">
          <el-form-item label="所属主体:" prop="enterpriseName">
            {{ agencyInfo.enterpriseName}}
          </el-form-item>
          <el-form-item label="待办人:" prop="userName">
            {{ agencyInfo.userName }}
          </el-form-item>
          <el-form-item label="通知时间:" prop="noticeTime">
            {{ agencyInfo.noticeTime |dateFormat }}
          </el-form-item>
          <el-form-item label="待办状态:" prop="status">
            {{ agencyInfo.status |agencyStatus}}
          </el-form-item>
          <el-form-item label="详细内容:" prop="content">
            {{ agencyInfo.content }}
          </el-form-item>
<!--          <el-form-item label="描述:" prop="remark">-->
<!--            {{ agencyInfo.remark }}-->
<!--          </el-form-item>-->
<!--          <el-form-item label="待办Id:" prop="remark">-->
<!--            {{ agencyInfo.agencyId }}-->
<!--          </el-form-item>-->
      </el-form>
    </div>
  </div>
</template>

<script>
import {getInCheckRecordsVo} from "@/api/maintenanceCheckRecords";
import {getInAgencyVo} from "@/api/agency";

export default {
  name: "agencyInfo",
  data() {
    return {

      agencyInfo: {},

    }
  },
  created() {
    this.$nextTick(() => {
      this.getInAgencyVo(this.$route.query.ucId)

    });
  },
  methods: {
    getInAgencyVo(val) {
      let loadingInstance = this.$loading({
        target: this.$refs.content,
        text: '数据加载中'
      });
      getInAgencyVo({ucId: val}).then(res => {
        console.log(res)
        this.agencyInfo = res.data
        loadingInstance.close()
        this.$notify.success({
          title: '成功',
          message: "获取待办事项成功"
        })

      }).catch(error => {
        console.log(error)
        loadingInstance.close()
        this.$notify.error({
          title: '失败',
          message: "获取待办事项失败"
        })
      })
    },
      toSource(){
          switch (this.agencyInfo.type){
              case  0:
                  this.$router.push("/nonEmergency/hiddenDangerInfo?ucId=" + this.agencyInfo.agencyId)
                  break;
              case  1:
                  this.$router.push("/workOrder/maintenanceInfo?ucId=" + this.agencyInfo.agencyId)
                  break;
              case  2:
                  this.$router.push("/maintenance/maintenanceTaskInfo?ucId=" + this.agencyInfo.agencyId+"&qyId="+this.agencyInfo.enterpriseId)
                  break;
              case  3:
                  this.$router.push("/maintenance/checkRecordsInfo?ucId=" + this.agencyInfo.agencyId)
                  break;
              case  4:
                  this.$router.push("/fireAlarm/fireInfoInfo/"+this.agencyInfo.agencyId)
                  break;
              case  5:
                  this.$router.push("/maintenance/checkRecordsInfo?ucId=" + this.agencyInfo.agencyId)
                  break;
              default :
                  break;
          }
      },
  }
}
</script>
<style>
</style>